package edu.uniquindio.prmaven.proyectofinal;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.Test;

import edu.uniquindio.prmaven.general.TestCore;

public class KeyBoard_1 extends TestCore {
	
	@Test()
	/**
	dataProviderClass = edu.uniquindio.prmaven.dataprovider.DataProviderFactory.class, 
	dataProvider = ConfigurationConstants.DP_FACTORY
	@DataProviderArguments(ConfigurationConstants.ESCENARIO
			+ ConfigurationConstants.EQUALS + DataProvidersConstants.HOJA_1)
			**/
	
	public void testKeyBoard_1() throws Exception {
		
		try {
			
		selenium.open("/showcase/");
		
		//selenium.click("id=SubMenu-Input"); Seleccionar menu Input
		WebElement menuInput=driver.findElement(By.id("SubMenu-Input"));
		menuInput.click();
		
		//selenium.click("link=• Keyboard");xpath .//*[@id='MENUSIDEindent']/div[3]/a[22]
		WebElement submenuKeyBoard=driver.findElement(By.xpath("//*[@id='MENUSIDEindent']/div[3]/a[22]"));
		submenuKeyBoard.click();
		
		selenium.waitForPageToLoad("30000");
		
		//selenium.click("css=button.keypad-trigger"); xpath .//*[@id='j_idt86']/table/tbody/tr[7]/td[2]/button
		//seleccion del campo button mode
		WebElement boton=driver.findElement(By.xpath(".//*[@id='j_idt86']/table/tbody/tr[7]/td[2]/button"));
		boton.click();
		
		//selenium.click("xpath=(//button[@type='button'])[2]"); selecciona la tecla "1"
		WebElement tecla1=driver.findElement(By.xpath("(//button[@type='button'])[2]"));
		tecla1.click();
		
		//selenium.click("xpath=(//button[@type='button'])[3]");Selecciona tecla "2"
		WebElement tecla2=driver.findElement(By.xpath("(//button[@type='button'])[3]"));
		tecla2.click();
		
		//selenium.click("xpath=(//button[@type='button'])[4]"); selecciona tecla "3"
		WebElement tecla3=driver.findElement(By.xpath("(//button[@type='button'])[4]"));
		tecla3.click();
		
		//selenium.click("xpath=(//button[@type='button'])[6]"); Selecciona Tecla "4"
		WebElement tecla4=driver.findElement(By.xpath("(//button[@type='button'])[6]"));
		tecla4.click();
		
		//selenium.click("xpath=(//button[@type='button'])[7]"); selecciona tecla "5"
		WebElement tecla5=driver.findElement(By.xpath("(//button[@type='button'])[7]"));
		tecla5.click();
		
		//selenium.click("xpath=(//button[@type='button'])[5]"); selecciona tecla "Close"
		WebElement teclaCerrar=driver.findElement(By.xpath("(//button[@type='button'])[5]"));
		teclaCerrar.click();
		
		//selenium.click("id=j_idt86:j_idt98"); boton Submit
		WebElement botonSubmit=driver.findElement(By.xpath("//*[@id='j_idt86:j_idt98']"));
		botonSubmit.click();
		
		
		Assert.assertEquals(selenium.getText("css=div.ui-dialog-content.ui-widget-content"), 
				"Value1: Value2: Value3: Value4: Value5: Value6: Value7: 12345 Value8: Value9:");
		
	}catch(AssertionError e){
		System.out.println("no se encontro texto");
	}finally{
		
	}
}

}


